<?php
/**
 * Pipahr
 *
 * @author Randy Zhao
 * @copyright 2013 pipahr.com
 */
defined('_JEXEC') or die;

// disable core styles to avoid bs conflict
OC_Util::$core_styles = array();

if (isDevMode()) {
   OCP\Util::addStyle('interview', 'interview');
   OCP\Util::addScript('interview', 'interview');
} else {
   OCP\Util::addStyle('static', 'interview');
   OCP\Util::addScript('static', 'apps/interview.interview.min');
   OCP\Util::addScript('static', 'jquery/ui/jquery.ui.datepicker.min');
}

$lang = PFactory::getLanguage();
$lang->load("com_jobs", JPATH_SITE, "zh-CN");

$company_url = PInterviewHelper::getCompanyUrl($_['basicInfo']->sub_domain,0);
$company_url = $company_url ? $company_url."?utp=nocp" : '';
?>

<script type="text/javascript" src="<?php print_unescaped(OC_Helper::linkTo('interview/js', 'interview.php'));?>"></script>

<div class="row-fluid">
   <div class="span12">
      <div class="company_info_box clearfix">
         <div class="company_showimg pull-left">
            <?php if (!empty($company_url)) : ?>
            <a href="<?=$company_url?>" target="_blank">
               <img src="<?php echo PCompanyHelper::showCompanyAvatar($_['basicInfo']->avatar, $_['basicInfo']->avatarapproved);?>" class="cpy_logo_mid"/>
            </a>
            <?php else : ?>
            <img src="<?php echo PCompanyHelper::showCompanyAvatar($_['basicInfo']->avatar, $_['basicInfo']->avatarapproved);?>" class="cpy_logo_mid"/>
            <?php endif;?>
         </div>
         <div class="company_showinfo">
            <h4 class="yahei">
               <?php if (!empty($company_url)) : ?>
               <a href="<?=$company_url?>" target="_blank"><?=$_['basicInfo']->comp_name?></a>
               <?php else : ?>
               <?=$_['basicInfo']->comp_name?>
               <?php endif;?>
               <i class="<?php echo $_['basicInfo']->validated == EMPLOYER_VALIDATED ? "is_approve" : "not_approve";?>"></i>
            </h4>
            <ul class="company_listinfo medium">
               <li>行业：<?php echo $_['basicInfo']->industry ? JText::_($_['basicInfo']->industry) : '未填写';?></li>
               <li>性质：<?php echo $_['basicInfo']->comp_type ? JText::_($_['basicInfo']->comp_type) : '未填写';?></li>
               <li>规模：<?php echo $_['basicInfo']->size_type ? JText::_($_['basicInfo']->size_type) : '未填写';?></li>
               <li>所在地区：<?php echo !empty($_['basicInfo']->cstate) || !empty($_['basicInfo']->ccity) ? $_['basicInfo']->cstate.$_['basicInfo']->ccity : "未填写";?></li>
            </ul>
         </div>
      </div>
   </div>
</div>

<div class="container">
   <div class="row-fluid">
      <div class="span12 blackbottom">
         <div class="company_position_show clearfix">
            招聘职位：<?php echo $_['basicInfo']->job_title ? $_['basicInfo']->job_title : '未填写';?> |
            工作城市：<?php echo ($_['basicInfo']->state || $_['basicInfo']->city) ? ($_['basicInfo']->state == $_['basicInfo']->city ? $_['basicInfo']->state : $_['basicInfo']->state.' '.$_['basicInfo']->city) : '未填写'; ?> |
            薪水：<?php echo $_['basicInfo']->salary_type ? $_['basicInfo']->salary_type : '未填写';?> |
            经验：<?php echo $_['basicInfo']->exp_name ? JText::_($_['basicInfo']->exp_name) : '未填写';?> |
            招聘人数：<?php echo $_['basicInfo']->num_needed ? $_['basicInfo']->num_needed : '未填写';?>
         </div>
      </div>
   </div>
</div>

<div class="container">
   <div class="row-fluid">
      <div class="span12">
         <div class="company_qes_fixed large clearfix"><?=$_['basicInfo']->job_title;?>职位线上竞聘</div>
      </div>
   </div>
</div>
<?php 
$sources = explode(",", $_['basicInfo']->source);
$sourcesname = "";
if(count($sources) > 1) {
   $sourcesname = '前程无忧和智联招聘';
}
else if(in_array('51job', $sources)) {
   $sourcesname = '前程无忧';
}
else if(in_array('zhilian', $sources)) {
   $sourcesname = '智联招聘';
}
else if(in_array('jiancai', $sources)) {
   $sourcesname = '建筑英才';
}
else if(in_array('upload', $sources)) {
   $sourcesname = '';
}
$online_interview_progress=json_decode($_['basicInfo']->online_interview_progress);
?>
<div class="row-fluid hr_oneconn_margin">
   <div class="span12 oneconn_box">
      <div class="lgrg_form">
         <div class="hr_inputinfo">
            <div class="hr_newstip">
               <span><?=$_['basicInfo']->jobseeker_name;?></span>，您好！<br/>

        <?php if(isset($online_interview_progress->interview) && $_['basicInfo']->giveup==0):?>
                                  您已经参加过该职位的线上竞聘，不能放弃！
        <?php else:?>
               <?php if(!empty($sourcesname)):?>
 您通过 <?=$sourcesname;?> 申请了<b><a href="<?=$company_url?>"><?=$_['basicInfo']->comp_name;?></a></b> 的 <b><?=$_['basicInfo']->job_title;?></b> 职位，
               <?php else:?>
               <b><a href="<?=$company_url?>"><?=$_['basicInfo']->comp_name;?></a></b> 诚邀您完成 <b><?=$_['basicInfo']->job_title;?></b> 的线上竞聘流程，
               <?php endif;?>
               如您确定放弃，您将失去获得该职位的宝贵机会。
            </div>
            <div class="hr_testerinfo_input emailvalidation" style="<?php echo $_['basicInfo']->giveup==1 ? 'display:none;' : '';?>">
               <p>
                  <span class="yellowcolor">请填写放弃原因</span>
               </p>
               <div class="hr_testinfo_form" style="margin-top:-5px;">
                  <form action="<?php echo OC_Helper::linkToRoute("interview_giveupconfirm");?>" method="post" name="giveupconfirm" id="giveupconfirm">
                     <div class="hr_form_group clearfix">
                        <div class="hr_controls" style="margin-left:287px;">
                           <label class="radio">
                             <input type="radio" class="{required:true, messages:{required:'请选择放弃原因'}}" name="reason" value="对该职位无兴趣">
                             对该职位无兴趣
                           </label>
                           <label class="radio">
                             <input type="radio" name="reason" value="已找到工作">
                             已找到工作
                           </label>
                           <label class="radio">
                             <input type="radio" name="reason" value="未投递简历">
                             未投递简历
                           </label>
                           <label class="radio">
                             <input type="radio" name="reason" value="不打算换工作">
                             不打算换工作
                           </label>
                           <label class="radio">
                             <input type="radio" name="reason" value="其他原因放弃">
                             其他
                           </label>
                        </div>
                     </div>
                     <div class="hr_form_group clearfix">
                        <div class="hr_controls" style="margin-left:290px;">
                           <input class="ppp_bluebtn" type="submit" value="提 交"> <a href="<?php echo OC_Helper::linkToRoute("interview_home", array('token'=>$_['token']));?>" style="margin-left:15px;">改主意啦，马上开始竞聘</a>
                           <input type="hidden" name="token" value="<?=$_['token']?>"/>
                           <input type="hidden" name="email" value="<?=$_['email']?>"/>
                           <input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>" id="requesttoken">
                           <br/><label id="errormsg" for="reason" generated="true" class="error" style="display:none;"></label>
                        </div>
                     </div>
                  </form>
               </div>
            </div>
            
            <div class="hr_testerinfo_input giveup_success" style="<?php echo $_['basicInfo']->giveup==1 ? '' : 'display:none;';?>">
               <div class="jobseeker_giveuptest yahei">已提交，您将不再收到关于此职位的信息。<br/><br/>
               <a class="songti" style="font-size:14px;font-weight:normal;" href="<?php echo OC_Helper::linkToRoute("interview_home", array('token'=>$_['token']));?>" style="margin-left:15px;">改主意啦，马上开始竞聘</a>
               </div>
            </div>
            <?php endif;?>
         </div>
      </div>
   </div>
</div>